#include <iostream>
using namespace std;

int n = 5,m = 5,arr[] = {1,2,3,4,5};
int solvespace[5] = {0};

void printOneSolution(){
    for(int i = 0;i < n;i++)
        if(solvespace[i])
            cout << arr[i] << " ";
    cout << endl;
}

void backtrack(int level = 0){
    if(level == n){//递归出口
        int sum = 0;
        for(int i = 0;i < n;i++)
            if(solvespace[i])
                sum += arr[i];
        if(sum > m)
            printOneSolution();
        return;
    }
    solvespace[level] = 1;
    backtrack(level+1);
    solvespace[level] = 0;
    backtrack(level+1);
}

int main(){
    backtrack();
    return 1;
}